package com.quickcode.example.collections;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;

import java.util.List;

/**
 * Created by 张波 on 2019/10/23.
 */
public class ImmutableExample2 {

    private final static List<String> list = ImmutableList.of("1","2","3");

    private final static ImmutableSet<String> set = ImmutableSet.copyOf(list);

    public static void main(String[] args) {
        System.out.println(list);
        System.out.println(set);
        //TODO 以下操作会报异常，Immutable对象一旦初始化后不允许进行修改
        list.add("1");
    }

}
